package com.ruoyi.system.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.SysDepartmentMapper;
import com.ruoyi.system.domain.SysDepartment;
import com.ruoyi.system.service.ISysDepartmentService;

/**
 * 部门管理Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-10-19
 */
@Service
public class SysDepartmentServiceImpl implements ISysDepartmentService 
{
    @Autowired
    private SysDepartmentMapper sysDepartmentMapper;

    /**
     * 查询部门管理
     * 
     * @param deptId 部门管理主键
     * @return 部门管理
     */
    @Override
    public SysDepartment selectSysDepartmentByDeptId(Long deptId)
    {
        return sysDepartmentMapper.selectSysDepartmentByDeptId(deptId);
    }

    /**
     * 查询部门管理列表
     * 
     * @param sysDepartment 部门管理
     * @return 部门管理
     */
    @Override
    public List<SysDepartment> selectSysDepartmentList(SysDepartment sysDepartment)
    {
        return sysDepartmentMapper.selectSysDepartmentList(sysDepartment);
    }

    /**
     * 新增部门管理
     * 
     * @param sysDepartment 部门管理
     * @return 结果
     */
    @Override
    public int insertSysDepartment(SysDepartment sysDepartment)
    {
        sysDepartment.setCreateTime(DateUtils.getNowDate());
        return sysDepartmentMapper.insertSysDepartment(sysDepartment);
    }

    /**
     * 修改部门管理
     * 
     * @param sysDepartment 部门管理
     * @return 结果
     */
    @Override
    public int updateSysDepartment(SysDepartment sysDepartment)
    {
        sysDepartment.setUpdateTime(DateUtils.getNowDate());
        return sysDepartmentMapper.updateSysDepartment(sysDepartment);
    }

    /**
     * 批量删除部门管理
     * 
     * @param deptIds 需要删除的部门管理主键
     * @return 结果
     */
    @Override
    public int deleteSysDepartmentByDeptIds(Long[] deptIds)
    {
        return sysDepartmentMapper.deleteSysDepartmentByDeptIds(deptIds);
    }

    /**
     * 删除部门管理信息
     * 
     * @param deptId 部门管理主键
     * @return 结果
     */
    @Override
    public int deleteSysDepartmentByDeptId(Long deptId)
    {
        return sysDepartmentMapper.deleteSysDepartmentByDeptId(deptId);
    }
}
